<?xml version='1.0' encoding='UTF-8'?>

<!DOCTYPE root PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:a4j="http://richfaces.org/a4j"
	xmlns:rich="http://richfaces.org/rich">

	<h:outputText rendered="#{estadoBean.saveState}">
		<div class="innerTitle">Cadastro de Estado</div>
	</h:outputText>

	<h:outputText rendered="#{estadoBean.updateState}">
		<div class="innerTitle">Atualização de Estado</div>
	</h:outputText>

	<h:inputHidden value="#{estadoBean.entity.id}" rendered="#{estadoBean.updateState}"/>

	<rich:tabPanel switchType="client">

		<rich:tab label="Cadastro">

			<h:panelGrid columns="3" styleClass="crud" columnClasses="label">

				<h:outputLabel value="Nome :"/>
				<h:inputText id="nomeEstado" value="#{estadoBean.entity.nome}" required="true" maxlength="2" size="2">
					<f:validateLength maximum="2" minimum="2"/>
					<rich:ajaxValidator event="onblur"/>
				</h:inputText>
				<rich:message errorClass="error" for="nomeEstado"/>

			</h:panelGrid>

		</rich:tab>

	</rich:tabPanel>

	<br/>

	<a4j:commandButton value="Inserir" type="submit" action="#{estadoBean.save}" styleClass="button" rendered="#{estadoBean.saveState}" reRender="popup"/>
	<a4j:commandButton value="Atualizar" type="submit" action="#{estadoBean.update}" styleClass="button" rendered="#{estadoBean.updateState}" reRender="popup"/>
	<a4j:commandButton value="Voltar" type="submit" action="#{estadoBean.search}" styleClass="button" immediate="true" reRender="popup"/>

</ui:composition>